<template>
  <div>
    <Chart :cdata="cdata" />
  </div>
</template>

<script>
import Chart from './chart.vue'
export default {
  data () {
    return {
      cdata: {
        category: [
          "5.61E+08",
          "5.7E+09",
          "5.7E+09",
          "6E+09",
          "6E+09",
          "6.3E+09",
          "6.3E+09",
          "6.6E+09",
          "6.6E+09",
          "6.9E+09",
          "6.9E+09",
          "7.2E+09",
          "7.2E+09",
          "7.5E+09",
          "7.5E+09",
          "7.8E+09",
          "7.8E+09",
        ],
        lineData: [
          0.003143,
          0.001358,
          0.001213,
          0.001505,
          0.001337,
          0.001444,
          0.001459,
          0.001205,
          0.001436,
          0.001305,
          0.001486,
          0.001390,
          0.001423,
          0.001225,
          0.001345,
          0.001282,
        ],
        barData: [
          0.005997,
          0.001198,
          0.000159,
          0.001204,
          0.000159,
          0.001209,
          0.000162,
          0.001215,
          0.000166,
          0.000648,
          0.000167,
          0.000528,
          0.000166,
          0.000536,
          0.000165,
          0.000542,
          0.000169,
        ],
        rateData: [
          0.006648,
          0.001545,
          0.000541,
          0.001551,
          0.000541,
          0.001558,
          0.000543,
          0.001564,
          0.000547,
          0.000996,
          0.000547,
          0.000877,
          0.000547,
          0.000884,
          0.000546,
          0.000089,
          0.000549,
        ],
      }
    };
  },
  components: {
    Chart,
  },
  mounted () {
    this.setData();
  },
  methods: {
    // 根据自己的业务情况修改
    setData () {
      for (let i = 0; i < this.cdata.barData.length -1; i++) {
        let rate = this.cdata.barData[i] / this.cdata.lineData[i];
        this.cdata.rateData.push(rate.toFixed(2));
      }
    },
  }
};
</script>

<style lang="scss" scoped>
</style>